package edu.nf.bs.controller;

import edu.nf.bs.util.BaiDuMapUnit;
import edu.nf.bs.vo.AddressVO;
import edu.nf.bs.vo.ResultVO;
import edu.nf.bs.vo.UserAddressVO;
import org.mvc.web.annotation.RequestMapping;
import org.mvc.web.servlet.View;
import org.mvc.web.view.JsonView;

import javax.servlet.http.HttpServletRequest;

public class AddressContraller extends BaseContraller{
    @RequestMapping("/address")
    public View getAddress(HttpServletRequest req){
        String userAddress = req.getParameter("userAddress");
        String shouAddress = req.getParameter("shouAddress");
        System.out.println(userAddress);
        System.out.println(shouAddress);
        UserAddressVO geocoderLatitude = BaiDuMapUnit.getGeocoderLatitude(userAddress);
        UserAddressVO geocoderLatitude1 = BaiDuMapUnit.getGeocoderLatitude(shouAddress);
        AddressVO vo = new AddressVO(geocoderLatitude, geocoderLatitude1);
        ResultVO success = success(vo);
        return new JsonView(success);
    }
}
